package FlyweightPattern.example;

import java.util.HashMap;

public class PiecesFactory {
    private static PiecesFactory singleton = new PiecesFactory();

    public static PiecesFactory getInstance() {
        return singleton;
    }

    private final HashMap<String, ChessPieces> hashMap;

    PiecesFactory() {
        this.hashMap = new HashMap<String, ChessPieces>();
        this.hashMap.put("white", new WhitePieces());
        this.hashMap.put("black", new BlackPieces());
    }

    public ChessPieces getChessPieces(String type) {
        return this.hashMap.get(type);
    }
}
